package com.dyz.model;

public final class Przychod extends AFaktura {
	
	private static float cenaNeto[] = new float[12];
	private static float cenaNetodod[] = new float[12];

	private float cenaNetto, cenaNettodod, cenaBrutto, kwotaVat;

	public Przychod(String number, String data, String companyName,
			String adress, String descr, int vat, float cenaNetto,
			float cenaNettodod) {
		super(number, data, companyName, adress, descr, vat);
		this.cenaNetto = cenaNetto;
		this.cenaNettodod = cenaNettodod;
		cenaBrutto = oblKwoteVat();
		kwotaVat = oblVat();
		cenaNeto[super.m-1]+=cenaNetto;
		cenaNetodod[super.m-1]+=cenaNettodod;
	}
	
	public static float getCenaNeto(int miesiac){
		return cenaNeto[miesiac];
	}
	public static float getCenaNetodod(int miesiac){
		return cenaNetodod[miesiac];
	}

	private float oblSume() {
		return cenaNetto + cenaNettodod;
	}

	private float oblVat() {
		return oblSume() * vat / 100;
	}

	private float oblKwoteVat() {
		return oblSume() * vat / 100 + oblSume();
	}

	public String toString() {
		return super.toString().concat(
				String.format("%.2f  %d  %.2f  %.2f  %.2f  przychod",
						cenaNetto, vat, kwotaVat, cenaBrutto, cenaNettodod));
	}

	public String toFormatString() {
		return super.toFormatString().concat(
				String.format(
						"|%-10.2f|%-3d|%-10.2f|%-10.2f|%-10.2f| przychod",
						cenaNetto, vat, kwotaVat, cenaBrutto, cenaNettodod));
	}

	public boolean isPrzychod() {
		return true;
	}

	public float getCenaNetto() {
		return cenaNetto;
	}

	public float getCenaDod() {
		return cenaNettodod;
	}

}